<div navbar ng-init="currentItem='task'"></div>
<div ng-show="!loaded"><div loading></div></div>

<div id="main" ng-show="loaded" style="display:none">
	<div class="module-header">
		<h3>计划任务</h3>
	</div>
		<div id="task" ng-init="loadTasks()">
			<div class="widget widget-table">
				<div class="widget-header">
					<i class="icon-list-alt"></i><h3>计划任务管理</h3>
					<div class="pull-right" style="margin-right:10px">
						<button class="btn btn-small" ng-click="taskaddconfirm()"><i class="icon-plus"></i> 添加新任务</button>
					</div>
				</div>
				<div class="widget-content">
					<table class="table table-striped table-hover table-bordered">
						<thead>
							<tr>
								<th style="width:50px" class="td-right">编号</th>
								<th style="width:100px">分钟(0-59)</th>
								<th style="width:100px">小时(0-23)</th>
								<th style="width:100px">日期(1-31)</th>
								<th style="width:100px">月份(1-12)</th>
								<th style="width:100px">星期(0-6)</th>
								<th style="width:200px">命令</th>
								<th style="width:100px">操作</th>
							</tr>
						</thead>
						<tbody>
							<tr ng-repeat="task in tasks">
								<td class="td-right">{{task.id}}</td>
								<td>{{task.minute}}</td>
								<td>{{task.hour}}</td>
								<td>{{task.dayofmon}}</td>
								<td>{{task.month}}</td>
								<td>{{task.dayofweek}}</td>
								<td>{{task.cmd}}</td>
								<td>
									<button class="btn btn-mini" ng-click="taskmodconfirm($index)">修改</button>
									<button class="btn btn-mini" ng-click="taskdelconfirm($index)">删除</button>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>

<div id="taskaddconfirm" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>添加新任务</h3>
  </div>
  <div class="modal-body">
	<form class="form-horizontal" onsubmit="return false">
		<div class="control-group">
			<label class="control-label">分钟(0-59)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.minute">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">小时(0-23)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.hour">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">日期(1-31)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.dayofmon">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">月份(1-12)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.month">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">星期(0-6)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.dayofweek">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">命令：</label>
			<div class="controls">
				<input type="text" ng-model="curtask.cmd">
			</div>
		</div>
	</form>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
    <button class="btn btn-primary" onclick="$('#taskaddconfirm').modal('hide')" ng-click="addTask()">添加</button>
  </div>
</div>

<div id="taskmodconfirm" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>修改编号 {{curtask.id}}的任务</h3>
  </div>
  <div class="modal-body">
	<form class="form-horizontal" onsubmit="return false">
		<div class="control-group">
			<label class="control-label">编号：</label>
			<div class="controls">
				<input readonly style="width:100px" type="text" ng-model="curtask.id">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">分钟(0-59)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.minute">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">小时(0-23)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.hour">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">日期(1-31)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.dayofmon">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">月份(1-12)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.month">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">星期(0-6)：</label>
			<div class="controls">
				<input style="width:100px" type="text" ng-model="curtask.dayofweek">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">命令：</label>
			<div class="controls">
				<input type="text" ng-model="curtask.cmd">
			</div>
		</div>
	</form>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
    <button class="btn btn-primary" onclick="$('#taskmodconfirm').modal('hide')" ng-click="taskMod()">确定</button>
  </div>
</div>

<div id="taskdelconfirm" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>删除编号{{curtask.id}}的任务</h3>
  </div>
  <div class="modal-body">
	<p>确定要删除编号:{{curtask.id}}任务 吗？</p>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
    <button class="btn btn-primary" onclick="$('#taskdelconfirm').modal('hide')" ng-click="taskDel()">确认删除</button>
  </div>
</div>